package com.mhy.rest.controller;

import com.mhy.rest.pojo.Book;
import com.mhy.rest.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@CrossOrigin
public class BookController {

    @Autowired
    BookService bookService;

    @GetMapping("/books")
    List<Book> getAllBook() {
        List<Book> bookList = bookService.queryAllBook();
        return bookList;
    }

    @PostMapping("/book")
    public boolean addOneBook(@RequestBody Book book) {
        System.out.println(" 添加 用户");
        System.out.println(book);
        return true;
    }
}
